package com.baizhi.mall.controller;

import com.baizhi.mall.util.ResultEntity;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api("测试响应信息的一个控制器")
public class TestResuEntityController {
    @GetMapping("test")
    @ApiOperation("测试不带参数的方法，返回一个错误信息")
    public ResultEntity<String> test() {
        /*return ResultEntity.error();*/
        return ResultEntity.ok("携带的数据");
    }

    @GetMapping("test2/{msg}")
    @ApiOperation("测试代码参数方法")
    public ResultEntity<String> test2(@PathVariable("mag") String msg){
        System.out.println(msg);
        return ResultEntity.ok("携带的数据");
    }
}